package com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming;

/**
 * createTime：2021/8/17 16:51
 * description：NapTask
 */
public class NapTask implements Runnable {
    final int id;

    public NapTask(int id) {
        this.id = id;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(100);
            System.out.println(this + " " + Thread.currentThread().getName());
        } catch (InterruptedException e) {
            System.out.println("Thread interruptedException is " + e.getMessage());
        }
    }

    @Override
    public String toString() {
        return "NapTask{" +
                "id=" + id +
                '}';
    }
}
